<?php
defined('BY_JYA') or exit('error');
list($id,$content,$nowait,$print_nums)=$arguments;
$setting=$this->plugin_setting('setting');
if(!$setting || !$setting['token'] || !$setting['api_key']){
	return error('接口参数错误！');
}
$seri_num=pdo_getcolumn('jy_print_print',array('id'=>$id),'pid');
if(!$seri_num){
	return error('指定打印机不存在！');
}
if($print_nums>1 && $print_nums<=10){
	for($i=0;$i<$print_nums;$i++){
		$nums = $i+1;
		$times_str = "《第".$nums."联》\n";
		$times_str .= "-----------------------\n";
		$pscontent = $times_str . $content;
		$result=$this->model('jinyunzn',$setting)->printing($seri_num,$pscontent,$print_type,$nowait);
	}
}else{
	$result=$this->model('jinyunzn',$setting)->printing($seri_num,$content,$print_type,$nowait);
}
if(is_array($result) && $result['code']==0){
	return true;
}else{
	return error($result['message']);
}
